<template>
    <div style="font-size: 12px;display: flex;line-height: 40px">
        <div  style="flex:1;font-size: 18px;text-align: left">
            <span :class="collapseBtnClass" style="cursor:pointer" @click="collapse"></span>
            <el-breadcrumb separator="/" style="display: inline-block">
                <el-breadcrumb-item :to="{path:'/'}">首页</el-breadcrumb-item>
<!--                <el-breadcrumb-item>{{ currentPathName }}</el-breadcrumb-item>-->
<!--                              <el-breadcrumb-item>{{ currentPathName }}</el-breadcrumb-item>-->

            </el-breadcrumb>
        </div>
        <el-dropdown style="white:400px;cursor:pointer">
            <i class="el-icon-setting" style="margin-right: 15px"></i>
            <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>
                    <router-link to="/person">个人信息</router-link>
                </el-dropdown-item>
                <el-dropdown-item>
                    <span style="text-decoration: none" @click="logout">退出</span>
                </el-dropdown-item>
            </el-dropdown-menu>

        </el-dropdown>
        <div style="display: inline-block">
            <img :src="user.avatar" alt="" style="width: 30px;border-radius: 50%; position: relative;top: 10px;right: 5px" >
            <span>{{user.nickname}}</span>
        </div>
    </div>
</template>

<script>
    import {arrayMethods} from "vue";

    export default {
        name: "Header",
        props:{
            collapseBtnClass:String,
            user:Object,
            collapse:arrayMethods,
        },

        computed:{
            currentPathName(){
                return this.$store.state.currentPathName;// 需要监听的数据
            }
        },
        data(){
            return{
            }
        },

      methods:{
            logout(){
                this.$router.push("/login")
                localStorage.removeItem("user")
                this.$message.success("退出成功！")
            },
            // collapse(){
            //     this.$emit("asideCollapse")
            // }
        }

    }

</script>

<style scoped>

</style>